﻿namespace EyeOpen.Data.Nhibernate
{
    using FluentNHibernate.Cfg;
    using NHibernate.Tool.hbm2ddl;

    public class NhibernateDataBase : IDatabase
    {
        private readonly FluentConfiguration fluentConfiguration;

        public NhibernateDataBase(FluentConfiguration fluentConfiguration)
        {
            this.fluentConfiguration = fluentConfiguration;
        }

        public void CreateDataBase()
        {
            var configuration = fluentConfiguration.BuildConfiguration();
            var schemaExport = new SchemaExport(configuration);
            schemaExport.Drop(false, true);
            schemaExport.Create(false, true);
        }
    }
}